package com.qf.controller;

import com.qf.Service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * 作者：大狗
 * 时间：2021/7/12 20:03
 */
@CrossOrigin("*")
@RestController
@RequestMapping("/pay")
public class PayController {
    @Autowired
    private PayService payService;

    @GetMapping("/send/{price}/{courseId}")
    public String sendOrder(@PathVariable Double price, @PathVariable Integer courseId){
        return payService.getPayUrl(price,courseId);//返回微信支付链接
    }
    //微信支付成功回调
    @GetMapping("/receive")
    public Object success(HttpServletRequest request){
        return payService.returnWechat(request);
    }



}
